package com.smalltao.sso.dao;

import com.smalltao.sso.entity.RoleMenu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author smallTao.liu
 * @version V1.0
 * @description
 * @date 2018/11/29 13:27
 */
@Repository
public interface RoleMenuRepository extends JpaRepository<RoleMenu, String> {

    /**
     * 根据角色id获取菜单ids
     *
     * @param roleIds
     * @return
     */
    @Query(value = "select distinct (menuUid) from RoleMenu where roleUid in (:roleIds)")
    List<String> findMenuUidByRoleUid(@Param("roleIds") List<String> roleIds);
}
